
package cz.czu.pef.DataModelling.ejb.impl;

import java.util.logging.*;

import javax.ejb.*;

import cz.czu.pef.DataModelling.dao.DaoBasic;
import cz.czu.pef.DataModelling.domainObjects.*;
import cz.czu.pef.DataModelling.ejb.api.*;
import cz.czu.pef.DataModelling.service.api.*;
import cz.czu.pef.DataModelling.utils.SpringLoader;

@Stateless(name = "personEJB", mappedName = "personEJB")
@Remote
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public class PersonEjbImpl extends AbstractEjbImpl<Person> implements PersonEjbInterface
{
  Logger logger = Logger.getLogger(PersonEjbImpl.class.getName());

  PersonService personService;

  @Override
  public DaoBasic<Person> getDaoBasic()
  {
    personService = SpringLoader.getContext().getBean(PersonService.class);
    return personService;
  }

  @Override
  public boolean canBeRemoved(Person person)
  {
    personService = SpringLoader.getContext().getBean(PersonService.class);
    return personService.canBeRemoved(person);
  }

  /*
  public String runDemo()
  {
  	return personService.runDemo();
  }

  public void addPerson(Person person)
  {
  	personService.merge(person);
  }

  public void removePersonById(long personId)
  {
    personService.removePersonById(personId);
  }

  public List<Person> listPeople()
  {
  	return personService.findAll();
  }
  */
}
